#ifndef SVGA_DRIVER_MESA_APP_UTILS_H
#define SVGA_DRIVER_MESA_APP_UTILS_H

#include <string.h>
#include <Psapi.h>

static const char* softColorFillAppList[] = { "Zoom.exe" };
static const char* jumpValidateSurfaceViewAppList[] = { "POWERPNT.EXE" };

static char* GetProcessName(char processName[MAX_PATH]) {
    HANDLE process = GetCurrentProcess();
    if (GetProcessImageFileNameA(process, processName, MAX_PATH) == 0) {
        return "";
    }
    char* name = strrchr(processName, '\\');
    if (name == NULL) {
        return "";
    }
    return name + 1;
}

static bool InAppList(const char** appList, unsigned count) {
    char processName[MAX_PATH];
    char* currentAppName = GetProcessName(processName);
    for (int i = 0; i < count; ++i) {
        if (strcmp(currentAppName, appList[i]) == 0) {
            return true;
        }
    }
    return false;
}
#endif //SVGA_DRIVER_MESA_APP_UTILS_H